package org.noote.libs.sogle;

import javax.microedition.khronos.opengles.GL10;

public class Object3D {

	public float _position[] = { 0, 0, 0 };
	public float _rotation[] = { 0, 0, 0 };

	public void setPosition(float px, float py, float pz) {
		_position[0] = px;
		_position[1] = py;
		_position[2] = pz;
	}
	
	public void setEulerRotation(float rx, float ry, float rz) {
		_rotation[0] = rx;
		_rotation[1] = ry;
		_rotation[2] = rz;
	}

	protected void _prepareDraw(GL10 gl) {
		gl.glPushMatrix();
		gl.glTranslatef(_position[0], _position[1], _position[2]);
		gl.glRotatef(_rotation[0], 1, 0, 0);
		gl.glRotatef(_rotation[1], 0, 1, 0);
		gl.glRotatef(_rotation[2], 0, 0, 1);
	}

	protected void _drawElement(GL10 gl) {
		// TODO :)
	}

	protected void _finishDraw(GL10 gl) {
		gl.glPopMatrix();
	}

	public void draw(GL10 gl) {
		_prepareDraw(gl);
		_drawElement(gl);
		_finishDraw(gl);
	}
}
